home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / D-G / FORTRAN Goodies / Launch Library / LAUNCH.TXT < prev   
Encoding:
Text File  |  1992-03-26  |  1.3 KB  |  57 lines  |  [TEXT/MPS ]

  1. c
  2. c F_Launch
  3. c
  4. c A FORTRAN-callable version of the _Launch trap.
  5. c
  6. c Takes one argument, a character variable or constant,
  7. c  the name of the application to launch.
  8. c
  9. c Trims trailing spaces from the application name,
  10. c  then executes the _Launch trap with an old-style
  11. c  parameter block. This causes the current application
  12. c  to terminate (no return to calling program).
  13. c
  14. c The launched application opens in the foreground under
  15. c  MultiFinder and System 7.
  16. c
  17. c  Example:
  18. c
  19. c    call F_Launch('myprog')
  20. c
  21. c    Terminates the current program and launches 'myprog'
  22. c     in the foreground under MultiFinder or System 7.
  23. c
  24. c NOTE: Be sure to save data structures and close open
  25. c  files before calling F_Launch!
  26. c
  27. c
  28.     subroutine F_Launch(name)
  29.     character*(*)    name
  30.     structure    /OldLaunchParms/
  31.         pointer    /string/    namep
  32.         integer*2            flags1,flags2
  33.     end structure
  34.     record        /OldLaunchParms/ LaunchRec
  35.     integer*2    I$$$HEX
  36.     integer*4    Areg0,Areg1
  37.     string        appname
  38.     
  39.     appname = trim(name)
  40.     
  41. c set up the short launch parameter block
  42.     LaunchRec.namep = %loc(appname)
  43.     LaunchRec.flags1 = 0            ! always
  44.     LaunchRec.flags2 = 0            ! always
  45.     
  46. c get a pointer to it in A0
  47. c NOTE: this will not work if you compile with -debug options!
  48. !!BKG-
  49.     Areg0 = %loc(LaunchRec)
  50.     Areg1 = 0
  51.     call LoadAddressReg(Areg0,Areg1)
  52.     
  53. c execute the _Launch trap (does not return)
  54.     I$$$HEX = $A9F2
  55.     end
  56.     
  57.